exports.packMessage = function(id, msg) {
    var size = msg.length + 2;
    var quotient = Math.floor(size / 256);
    var remainder = size % 256;
    var sizeBuf = Buffer.alloc(2);
    sizeBuf[0] = remainder;
    sizeBuf[1] = quotient;
    var typeBuf = Buffer.alloc(2);
    typeBuf[1] = Math.floor(id / 256);
    typeBuf[0] = id % 256;
    var buf = Buffer.concat([sizeBuf, typeBuf, msg]);
    return buf;
}
